package com.avicit.zipkinkafkaesserver.dao.es.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ZipkinInterfaceCountES implements Serializable {

    private String id;
    private String interfaceIp;
    private Integer serverPort;
    private String serverName;
    private String interfacePath;
    private String interfaceStatus;
    private Integer interfaceCount;

    private String queryKey;
    //server-a@GET@/getInfo
    private String interfaceKey;
    //抓取es 记录中的开始时间
    private Long esStartTime;
    //抓取es 记录中的结束时间
    private Long esEndTime;

    //记录生成时间段的开始时间
    private Long queryStartTime;
    //记录生成时间段的结束时间
    private Long queryEndTime;

    public String getInterfaceKey() {
        if (this.queryKey == null) {return "";}
        String[] split = this.queryKey.split("@");
        return this.interfaceKey = new StringBuffer()
                .append(split[1]).append("@")//服务名
                .append(split[2]).append("@")//请求方法
                .append(split[3])//接口路径
                .toString();
    }


}
